class code1 {
    //方法一：sum-nums[i]
    public int missingNumber(int[] nums) {
        int sum = 0;
        int i=0;
        for(;i<nums.length;i++) {
            sum += i;
            sum -= nums[i];
        }
        sum += i;
        return sum;
    }
}